//获取当前目录下所有的文件信息(不限于Mk开头的文件)
const modulesFilesDeep = import.meta.glob('./**/*.vue', { eager: true });
const pathListDeep: any[] = [];
//遍历拿到所有的文件名称
for (const path in modulesFilesDeep) {
	pathListDeep.push(path);
}

const mkComponent = {
	install(app: any) {
		pathListDeep.forEach((path) => {
			/*组件一定要声明name
			 **  组合式：
			 **  defineOptions({
			 **   name: 'MKForm'
			 **  })
			 **  选项式：
			 **   name: 'MKForm'
			 */
			const component = (modulesFilesDeep as any)[path].default;
			app.component(component.name, component);
		});
	},
};

export default mkComponent;
